<!DOCTYPE html>
<html>
<head>
	<title></title>
	 <meta name="viewport" content="width=device-width,initial-scale=1.0">
	<style type="text/css">
	.main{
		width: 2rem;
		height: 2rem;
		background: red;
	}
	</style>
</head>
<body>

<div class='main'>
	
	11111


</div>


<script type="text/javascript">
//当浏览器、设备发生变化时，触发的事件

function fun(){
	document.documentElement.style.fontSize = document.documentElement.clientWidth/10+'px';
}
fun();


window.onresize = function(){

	fun();

}	

</script>


</body>
</html>